package com.sitech.openapi.controller.ProductOffer;

import com.sitech.openapi.componet.SetHttpHeaderCmpt;
import com.sitech.openapi.controller.AbstractController;
import com.sitech.openapi.domain.user.OfferInst;
import com.sitech.openapi.service.ProdOfferInstInfoService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpHeaders;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * 关于随选宽带销售品实例上传至集团集约系统的工作通知
 * Created by yinjj on 2019/2/14.
 */
@RestController
@Slf4j
@Api(tags = "查询销售品实例", description = "查询销售品实例")
public class QryProdOfferInstInfoController extends AbstractController {
    @Autowired
    ProdOfferInstInfoService prodOfferInstInfoService;
    @Autowired
    private SetHttpHeaderCmpt setHttpHeaderCmpt;

    @GetMapping("/offerInst")
    @ApiOperation(value = "查询销售品实例接口", notes = "查询销售品实例接口")
    public ResponseEntity<List> queryTestByPara(@RequestParam(required = false) String accNum,
                                                           @RequestParam(required = false) String account,
                                                           @RequestHeader HttpHeaders headers)throws  Exception {
        log.info("入参--------------accNum--------------" + accNum);
        log.info("入参--------------account--------------" + account);

        Map<String,Object> map = new HashMap<>();
        map.put("accNum",accNum);
        map.put("account",account);
        List retList = prodOfferInstInfoService.qryKDSXOfferInfo(map);
        HttpHeaders httpHeaders = setHttpHeaderCmpt.setOKHttpHeaders(headers);
        ResponseEntity<List> res = new ResponseEntity<List>(retList, httpHeaders, HttpStatus.OK);
        return res;
    }
}
